<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>公众号跳转</title>
  <style>
    *{
      margin: 0;
      padding: 0;
      -webkit-user-select: none;
      -webkit-tap-highlight-color: rgba(200,200,200,0);
    }
    body{
      background: #fff;
    }
    a{
      color: #000;
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%,-50%);
    }
    a{

      width: 100%;
      height: 100%;
      text-decoration: none;
      background: url(./bg.png) no-repeat;
      background-size: cover;
      background-position: 50% 50%;
    }
  </style>
</head>
<body>
  <a id="link" target="_blank" href=""></a>
  <script>
    function getQueryString(name) {
      var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
      var r = window.location.search.substr(1).match(reg);
      if (r != null) return decodeURI(r[2]); return null;
    }
    let link = document.querySelector('#link')
    let url = decodeURIComponent(getQueryString('url'))
    link.href = url

    document.querySelector('#link').addEventListener('click',function (e) {
      console.log('closePop')
      window.top.postMessage('closePop','*')
    })

  </script>
</body>
</html>